<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>实名认证</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../css/css.css" />
</head>

<body>
<style>
    [v-cloak] {
        display: none;
    }
</style>
    <div v-cloak id="wrap" class="flex-wrap flex-vertical">
        <header>
            <ul>
                <li class="active">
                    <i onclick="back()" class="icon iconfont icon-back"></i>
                    <span>实名认证</span>
                </li>
            </ul>
        </header>
        <div class="authentication fixed-header">
            <div class="reg-form">
                <div class="reg-form1">
                    <span>姓名</span>
                    <div class="reg-input">
                        <input class="w100" v-if="sfz==''" v-model="nickname" type="text" placeholder="请输入真实姓名">
                        <input class="w100" v-else readonly v-model="nickname" type="text" placeholder="请输入真实姓名">
                    </div>
                </div>
                <div class="reg-form1">
                    <span>身份证</span>
                    <div class="reg-input">
                        <input class="w100" v-if="sfz==''" v-model="shenfenzheng" type="text" placeholder="请输入身份证号码">
                        <input class="w100" v-else readonly v-model="shenfenzheng" type="text" placeholder="请输入身份证号码">
                    </div>
                </div>
            </div>
            <div class="login-form">
                <div class="sub-login" v-if="sfz==''" @click="getAuthentication">
                    提交
                </div>
            </div>
        </div>
    </div>
</body>

</html>
<script src="../../aui/js/aui.js"></script>
<script src="../../script/vue2.js"></script>
<script src="../../script/vue-resource.min.js"></script>
<script src="../../script/common.js"></script>
<script>
var vm = new Vue({
    el: "#wrap",
    data: {
        userinfo: [],
        editAddress: false,
        userinfo2: [],
        bio: '',
        sfz: '',
        card: '',
        avatar: '',
        nickname: '',
        mobile: '',
        checked: 0,
        shenfenzheng: ''
    },
    mounted: function() {
        var that = this;
        apiready = function() {
            // that.getrefUserinfo()
            that.sfz = $api.getStorage('userInfo').sfz
            that.shenfenzheng = $api.getStorage('userInfo').sfz
            that.nickname = $api.getStorage('userInfo').nickname
            console.log(that.sfz)
            if (!$api.getStorage('userInfo')) { //判断是否登录
                if (api.systemType == "ios") {
                    var times = 0;
                } else {
                    var times = 300;
                }
                api.openWin({ //未登录打开登陆窗口
                    name: 'login',
                    url: './html/login/login.html',
                    delay: times,
                    slidBackType: 'edge',
                    vScrollBarEnabled: false,
                    slidBackEnabled: false,
                })
                return
            }
        };
    },
    methods: {
        getAuthentication: function() {
            var that = this;
            showProgress();
            var token = $api.getStorage('userInfo').token
            api.ajax({
                url: ajaxRoute.verify,
                method: 'post',
                data: {
                    values: {
                        token: token,
                        nickname: that.nickname,
                        shenfenzheng: that.shenfenzheng,
                    }
                }
            }, function(res, err) {
                if (res.code == 1) {
                    api.toast({ msg: '提交成功', location: 'middle' });
                    api.hideProgress();
                } else {
                    api.hideProgress();
                    api.toast({ msg: res.msg, location: 'middle' });
                }
            });
        }
    },
    filters: {
        getTel: function(value) {
            var phone = value
            return phone.substr(0, 3) + "****" + phone.substr(7)
        },
        getCard: function(value) {
            var phone = value
            return phone.substr(0, 5) + "********" + phone.substr(12)
        },
        getchecked: function(e) {
            var checked = ''
            if (e == 0) {
                checked = '审核中'
            } else {
                checked = '已审核'
            }
            return checked
        }
    }
})
</script>
